package com.dongjiantong.farmrecords.service;

import com.dongjiantong.common.web.sso.LoginInfo;
import com.dongjiantong.farmrecords.model.FarmRecordsDiagnosis;
import com.dongjiantong.farmrecords.model.FarmRecordsFile;
import com.dongjiantong.mybatis.BaseService;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Map;

public interface FarmRecordsDiagnosisService extends BaseService<FarmRecordsDiagnosis> {

    /**
     * 根据条件进行分页查询 (无条件表示查询全部)
     * @param pageNum
     * @param pageSize
     * @param map   查询条件
     * @return  Response<PageInfo<FarmRecordsDiagnosis>>
     */
    PageInfo<FarmRecordsDiagnosis> selectByMap(Integer pageNum, Integer pageSize, Map map);

    /**
     * 新建一条记录 (直接暂存 或者 直接提交)
     * @param farmRecordsDiagnosis
     * @param loginInfo
     * @param toStatus
     * @return  long 返回插入数据的id
     */
    Long createOne(LoginInfo loginInfo,FarmRecordsDiagnosis farmRecordsDiagnosis, Integer toStatus);

    /**
     * 更新一条记录 (根据id或者number)
     * @param farmRecordsDiagnosis
     * @return  boolean (更新成功返回true 反之返回false)
     */
    Integer updateByIdOrNumber(FarmRecordsDiagnosis farmRecordsDiagnosis,Integer toStatus);

    /**
     * 查询诊疗记录(牛)
     * @param pageNum
     * @param pageSize
     * @param map
     * @return
     */
    PageInfo<FarmRecordsDiagnosis> selectBullByMap(Integer pageNum, Integer pageSize, Map map);

    /**
     * 养殖端
     * 根据提交状态分页查询列表
     * @param farmId
     * @param status
     * @return
     */
    PageInfo<FarmRecordsDiagnosis> selectListByStatus(Integer pageNum, Integer pageSize, Integer status, Long farmId, Integer nonBull);

    /**
     * 放入图片 视频到对象中
     * @param farmRecordsDiagnosis
     * @param farmRecordsFileList
     */
    FarmRecordsDiagnosis setPicOrVideoByObject(FarmRecordsDiagnosis farmRecordsDiagnosis, List<FarmRecordsFile> farmRecordsFileList);

    /**
     * 根据关联牛档案id 查询对应的诊疗记录
     * @param cowRecordId
     * @return
     */
    List<FarmRecordsDiagnosis> selectBullDiagnosis(Long cowRecordId);

    /**
     * 新增牛档案 诊疗记录
     * @param loginInfo
     * @param farmRecordsDiagnosis
     * @param toStatus
     * @return
     */
    Long createBullOne(LoginInfo loginInfo, FarmRecordsDiagnosis farmRecordsDiagnosis, Integer toStatus);

    /**
     * 根据牛档案关联单据Ids 查询诊疗次数
     * @param ids
     * @return
     */
    List<Map<String, Object>> selectDiagnosisCount(List<Long> ids);

    Integer updateEarNumberByCowRelateId(Long id, String ear_tag_number);
}
